package day6;

import java.util.Arrays;

/**
 * @author oldliu
 * @since 1.0
 */
public class ArrayTest2 {
    public static void main(String[] args) {
        int[] a = {200, 23, 212, 414, 734, 374, 74, 42, 18, 56, 88, 32, 23, 22, 21};


        //int a[] = {1, 3, 6};
        int[] b = Arrays.copyOf(a, 11);
        System.out.println(Arrays.toString(b));
        int[] c = Arrays.copyOfRange(a, 3, 8);
        System.out.println(Arrays.toString(c));

        int k = 18;
        //折半查找
        Arrays.sort(a);//a必须是升序
        for (int i = 0; i < a.length / 2; i++) {
            int temp = a[i];
            a[i] = a[a.length - 1 - i];
            a[a.length - 1 - i] = temp;
        }
        System.out.println(Arrays.toString(a));
        int pos = Arrays.binarySearch(a, k);
        System.out.println("位置：" + (pos < 0 ? "没有" : "赵到了，位置是" + pos));

        int c1[] = {1, 4, 6, 12, 7, 8, 10};
        int c2[] = {1, 4, 6, 12};
        int mismatch = Arrays.mismatch(c1, c2);
        System.out.println(mismatch);
        //Arrays.
    }
}
